package Dao;

import java.sql.*;

public class DBconnection {
    /**
     * @author 张潇川
     * 创建数据库链接
     *
     * @return 返回数据库链接对象
     *
     */
    public static Connection getConn() {

        Connection connection = null;
        String username = "root";
        String password = "960913";
        String url = "jdbc:mysql://localhost:3306/sc?useSSL=true";

        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(url, username, password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return connection;
    }
}
